package com.zonta.finance.config;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zonta.finance.common.dto.PageInfo;
import com.zonta.finance.domain.form.*;
import com.zonta.finance.domain.po.*;
import com.zonta.finance.domain.vo.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface ObjectConvertor {

    @Mappings({@Mapping(target = "value", source = "id"),
            @Mapping(target = "title", source = "name")})
    ListTreeSelectMenuVo toListTreeSelectMenuVo(SysMenu source);

    List<ListTreeSelectMenuVo> toListTreeSelectMenuVo(List<SysMenu> source);
    @Mappings({@Mapping(target = "key", source = "id"),
            @Mapping(target = "title", source = "name")})
    ListTreeMenuVo toListTreeMenuVo(SysMenu source);

    List<ListTreeMenuVo> toListTreeMenuVo(List<SysMenu> source);

    SysMenu toSysMenu(CreateMenuForm source);

    GetMenuByIdVo toGetMenuByIdVo(SysMenu source);

    SysResource toSysResource(CreateSysResourceForm source);
    GetSysResourceVo toGetSysResourceVo(SysResource source);
    List<ListSysResourceVo> toListSysResourceVo(List<SysResource> source);
    @Mappings({
            @Mapping(target = "pageNum", source = "current"),
            @Mapping(target = "pageSize", source = "size"),
            @Mapping(target = "list",source = "records")
    })
    PageInfo<ListRoleVo> toListRoleVoPage(Page<SysRole> source);
    GetRoleDetailVo toGetRoleDetailVo(SysRole source);

    MenuDataItemVo toMenuDataItemVo(SysMenu source);

    List<MenuDataItemVo> toMenuDataItemVo(List<SysMenu> source);

    GetAccountBookVo toGetAccountBookVo(AccountBook source);

    @Mappings({
            @Mapping(target = "pageNum", source = "current"),
            @Mapping(target = "pageSize", source = "size"),
            @Mapping(target = "list",source = "records")
    })
    PageInfo<ListAccountBookVo> toListAccountBookVoPage(Page<AccountBook> source);

    AccountBook handleSaveAccountBook(AddAccountBookForm form);

    List<DataDictionaryVo> toDataDictionaryVo(List<DataDictionary> data);

    List<ListCurrencyConfigVo> toListCurrencyConfigVo(List<CurrencyConfig> source);

    CurrencyConfig toCurrencyConfig(CreateCurrencyConfigForm source);

    GetCurrencyConfigVo toGetCurrencyConfigVo(CurrencyConfig source);

    VoucherWordConfig toVoucherWordConfig(CreateVoucherWordConfigForm source);

    GetVoucherWordConfigVo toGetVoucherWordConfigVo(VoucherWordConfig source);

    List<ListVoucherWordConfigVo> toListVoucherWordConfigVo(List<VoucherWordConfig> source);
}